package com.lsa.helpers.tree;

import java.io.IOException;

import junit.framework.TestCase;

import com.lsa.helpers.Pair;

public class TestTgfTree extends TestCase
{
    public void testTreeRead(){
        ITree<Pair<String, Object>> simpleTree = null;
        try
        {
            simpleTree = TgfTreeFactory.readStringTreeFromFile("data/simpleBinaryTree.tgf");
            TgfTreeFactory.saveStringTreeAsTgf(simpleTree, "data/simpleBinaryTreeOut.tgf");
        }
        catch( IOException e )
        {
            e.printStackTrace();
        }
    }
    
    public void testCreateRandomTree(){
        ITree<Pair<String, Object>> simpleTree = RandomTreeFactory.createRandomTree(10, false);
        try
        {
//            TgfTreeFactory.saveStringTreeAsTgf(simpleTree, "data/randomBinaryTree25.tgf");
            TgfTreeFactory.saveStringTreeAsTgf(simpleTree, "data/randomTree10.tgf");
        }
        catch( IOException e )
        {
            e.printStackTrace();
        }
    }
}
